package com.ruoyi.task;


import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Record;
//import com.ruoyi.web.controller.tool.dataManage.DataSetUtil;
import com.ruoyi.web.controller.tool.dataManage.DataSetUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@Configuration     //1.主要用于标记配置类，兼备Component的效果。
@EnableScheduling   // 2.开启定时任务
@Component("Task")
/**
 * 使用自定義的定時任務
 */
public class SaticScheduleTask {
    private final Logger logger = LoggerFactory.getLogger(getClass());
    @Autowired

    /**
     * 定时执行任务
     */
//    @Scheduled(cron = "0 0 23 * * ?" )//每天23点整定时执行
//    @Scheduled(cron = "0 */5 * * * ?")//每1分整定时执行
    @Scheduled(cron = "${scheduler.timeTask}")
    public void configureTasks_23() {
        try {
            //定时需要抽取数据集的相关代码
       String[] tmp = { "gjgbs"};

//            String[] tmp = {"cscsjcxx", "gjgbs", "gjgfkjc", "gjghpvjc", "gjgsf", "gjgxbxjc", "gjgydjjc", "gjgzhzd", "gjgzzxjc", "rxabs", "rxasf", "rxaxx", "rxgczxx"};
            for (String table : tmp) {
                logger.info("定时任务开始抽取" + table + "数据");
                Record data = Db.findFirst("select * from sys_data_set where code=?", table);
                if (data != null) {
                    String key = data.getStr("id");
                    Map<String, Object> dataMap = DataSetUtil.getDataSetRoot(key);
                    List<Map<String, Object>> dataList = (List<Map<String, Object>>) dataMap.get(table);
                    List<Record> insertList = new ArrayList<>();
                    for (Map<String, Object> addMap : dataList) {
                        Record addData = new Record();
                        addData.setColumns(addMap);
                        insertList.add(addData);
                    }

                    Db.batchSave(table, insertList, 500);
                    logger.info("定时任务结束抽取" + table + "数据,共计抽取到" + insertList.size() + "条数据");


                } else {
                    logger.info("找不到表[" + table + "]对应的数据集！请检查数据集配置！");
                }
            }
        }
        catch(Exception e)
            {
                logger.error("每天23点整定时执行gjgbs任务出错：" + e.toString());
            }
        finally{
            //释放资源

        }
//        try {
//            Db.use("peis222").update("update pe_master_index set nation=0 where pe_id='TJ01811323'");
//        }
//        catch(Exception e)
//        {
//            logger.error("每天23点整定时执行任务出错：" + e.toString());
//        }


        //hpv*****************************************************************************************
        try {
            //定时需要抽取数据集的相关代码
            String table = "gjghpvjc";

                logger.info("定时任务开始抽取" + table + "数据");
                Record data = Db.findFirst("select * from sys_data_set where code=?", table);
                if (data != null) {
                    String key = data.getStr("id");
                    Map<String, Object> dataMap = DataSetUtil.getDataSetRoot(key);
                    List<Map<String, Object>> dataList = (List<Map<String, Object>>) dataMap.get(table);
                    List<Record> insertList = new ArrayList<>();
                    for (Map<String, Object> addMap : dataList) {
                        Record addData = new Record();
                        addData.setColumns(addMap);
                        insertList.add(addData);
                    }

                    Db.batchSave(table, insertList, 500);
                    logger.info("定时任务结束抽取" + table + "数据,共计抽取到" + insertList.size() + "条数据");


                } else {
                    logger.info("找不到表[" + table + "]对应的数据集！请检查数据集配置！");
                }

        }
        catch(Exception e)
        {
            logger.error("每天23点整定时执行任务gjghpvjc出错：" + e.toString());
        }
        //gjgfkjc*****************************************************************************************
        try {
            //定时需要抽取数据集的相关代码
            String table = "gjgfkjc";

            logger.info("定时任务开始抽取" + table + "数据");
            Record data = Db.findFirst("select * from sys_data_set where code=?", table);
            if (data != null) {
                String key = data.getStr("id");
                Map<String, Object> dataMap = DataSetUtil.getDataSetRoot(key);
                List<Map<String, Object>> dataList = (List<Map<String, Object>>) dataMap.get(table);
                List<Record> insertList = new ArrayList<>();
                for (Map<String, Object> addMap : dataList) {
                    Record addData = new Record();
                    addData.setColumns(addMap);
                    insertList.add(addData);
                }

                Db.batchSave(table, insertList, 500);
                logger.info("定时任务结束抽取" + table + "数据,共计抽取到" + insertList.size() + "条数据");


            } else {
                logger.info("找不到表[" + table + "]对应的数据集！请检查数据集配置！");
            }

        }
        catch(Exception e)
        {
            logger.error("每天23点整定时执行任务gjgfkjc出错：" + e.toString());
        }
        //gjgfkjc*****************************************************************************************
        try {
            //定时需要抽取数据集的相关代码
            String table = "gjgfkjc";

            logger.info("定时任务开始抽取" + table + "数据");
            Record data = Db.findFirst("select * from sys_data_set where code=?", table);
            if (data != null) {
                String key = data.getStr("id");
                Map<String, Object> dataMap = DataSetUtil.getDataSetRoot(key);
                List<Map<String, Object>> dataList = (List<Map<String, Object>>) dataMap.get(table);
                List<Record> insertList = new ArrayList<>();
                for (Map<String, Object> addMap : dataList) {
                    Record addData = new Record();
                    addData.setColumns(addMap);
                    insertList.add(addData);
                }

                Db.batchSave(table, insertList, 500);
                logger.info("定时任务结束抽取" + table + "数据,共计抽取到" + insertList.size() + "条数据");


            } else {
                logger.info("找不到表[" + table + "]对应的数据集！请检查数据集配置！");
            }

        }
        catch(Exception e)
        {
            logger.error("每天23点整定时执行任务gjgfkjc出错：" + e.toString());
        }
        //gjgxbxjc*****************************************************************************************
        try {
            //定时需要抽取数据集的相关代码
            String table = "gjgxbxjc";

            logger.info("定时任务开始抽取" + table + "数据");
            Record data = Db.findFirst("select * from sys_data_set where code=?", table);
            if (data != null) {
                String key = data.getStr("id");
                Map<String, Object> dataMap = DataSetUtil.getDataSetRoot(key);
                List<Map<String, Object>> dataList = (List<Map<String, Object>>) dataMap.get(table);
                List<Record> insertList = new ArrayList<>();
                for (Map<String, Object> addMap : dataList) {
                    Record addData = new Record();
                    addData.setColumns(addMap);
                    insertList.add(addData);
                }

                Db.batchSave(table, insertList, 500);
                logger.info("定时任务结束抽取" + table + "数据,共计抽取到" + insertList.size() + "条数据");


            } else {
                logger.info("找不到表[" + table + "]对应的数据集！请检查数据集配置！");
            }

        }
        catch(Exception e)
        {
            logger.error("每天23点整定时执行任务gjgxbxjc出错：" + e.toString());
        }
        //gjgydjjc*****************************************************************************************
        try {
            //定时需要抽取数据集的相关代码
            String table = "gjgydjjc";

            logger.info("定时任务开始抽取" + table + "数据");
            Record data = Db.findFirst("select * from sys_data_set where code=?", table);
            if (data != null) {
                String key = data.getStr("id");
                Map<String, Object> dataMap = DataSetUtil.getDataSetRoot(key);
                List<Map<String, Object>> dataList = (List<Map<String, Object>>) dataMap.get(table);
                List<Record> insertList = new ArrayList<>();
                for (Map<String, Object> addMap : dataList) {
                    Record addData = new Record();
                    addData.setColumns(addMap);
                    insertList.add(addData);
                }

                Db.batchSave(table, insertList, 500);
                logger.info("定时任务结束抽取" + table + "数据,共计抽取到" + insertList.size() + "条数据");


            } else {
                logger.info("找不到表[" + table + "]对应的数据集！请检查数据集配置！");
            }

        }
        catch(Exception e)
        {
            logger.error("每天23点整定时执行任务gjgydjjc出错：" + e.toString());
        }
        //rxabs*****************************************************************************************
        try {
            //定时需要抽取数据集的相关代码
            String table = "rxabs";

            logger.info("定时任务开始抽取" + table + "数据");
            Record data = Db.findFirst("select * from sys_data_set where code=?", table);
            if (data != null) {
                String key = data.getStr("id");
                Map<String, Object> dataMap = DataSetUtil.getDataSetRoot(key);
                List<Map<String, Object>> dataList = (List<Map<String, Object>>) dataMap.get(table);
                List<Record> insertList = new ArrayList<>();
                for (Map<String, Object> addMap : dataList) {
                    Record addData = new Record();
                    addData.setColumns(addMap);
                    insertList.add(addData);
                }

                Db.batchSave(table, insertList, 500);
                logger.info("定时任务结束抽取" + table + "数据,共计抽取到" + insertList.size() + "条数据");


            } else {
                logger.info("找不到表[" + table + "]对应的数据集！请检查数据集配置！");
            }

        }
        catch(Exception e)
        {
            logger.error("每天23点整定时执行任务rxabs出错：" + e.toString());
        }
        //rxgczxx*****************************************************************************************
        try {
            //定时需要抽取数据集的相关代码
            String table = "rxgczxx";

            logger.info("定时任务开始抽取" + table + "数据");
            Record data = Db.findFirst("select * from sys_data_set where code=?", table);
            if (data != null) {
                String key = data.getStr("id");
                Map<String, Object> dataMap = DataSetUtil.getDataSetRoot(key);
                List<Map<String, Object>> dataList = (List<Map<String, Object>>) dataMap.get(table);
                List<Record> insertList = new ArrayList<>();
                for (Map<String, Object> addMap : dataList) {
                    Record addData = new Record();
                    addData.setColumns(addMap);
                    insertList.add(addData);
                }

                Db.batchSave(table, insertList, 500);
                logger.info("定时任务结束抽取" + table + "数据,共计抽取到" + insertList.size() + "条数据");


            } else {
                logger.info("找不到表[" + table + "]对应的数据集！请检查数据集配置！");
            }

        }
        catch(Exception e)
        {
            logger.error("每天23点整定时执行任务rxgczxx出错：" + e.toString());
        }
        //cscsjcxx*****************************************************************************************
        try {
            //定时需要抽取数据集的相关代码
            String table = "cscsjcxx";

            logger.info("定时任务开始抽取" + table + "数据");
            Record data = Db.findFirst("select * from sys_data_set where code=?", table);
            if (data != null) {
                String key = data.getStr("id");
                Map<String, Object> dataMap = DataSetUtil.getDataSetRoot(key);
                List<Map<String, Object>> dataList = (List<Map<String, Object>>) dataMap.get(table);
                List<Record> insertList = new ArrayList<>();
                for (Map<String, Object> addMap : dataList) {
                    Record addData = new Record();
                    addData.setColumns(addMap);
                    insertList.add(addData);
                }

                Db.batchSave(table, insertList, 500);
                logger.info("定时任务结束抽取" + table + "数据,共计抽取到" + insertList.size() + "条数据");


            } else {
                logger.info("找不到表[" + table + "]对应的数据集！请检查数据集配置！");
            }

        }
        catch(Exception e)
        {
            logger.error("每天23点整定时执行任务cscsjcxx出错：" + e.toString());
        }

        //rxaxx*****************************************************************************************
        try {
            //定时需要抽取数据集的相关代码
            String table = "rxaxx";

            logger.info("定时任务开始抽取" + table + "数据");
            Record data = Db.findFirst("select * from sys_data_set where code=?", table);
            if (data != null) {
                String key = data.getStr("id");
                Map<String, Object> dataMap = DataSetUtil.getDataSetRoot(key);
                List<Map<String, Object>> dataList = (List<Map<String, Object>>) dataMap.get(table);
                List<Record> insertList = new ArrayList<>();
                for (Map<String, Object> addMap : dataList) {
                    Record addData = new Record();
                    addData.setColumns(addMap);
                    insertList.add(addData);
                }

                Db.batchSave(table, insertList, 500);
                logger.info("定时任务结束抽取" + table + "数据,共计抽取到" + insertList.size() + "条数据");


            } else {
                logger.info("找不到表[" + table + "]对应的数据集！请检查数据集配置！");
            }

        }
        catch(Exception e)
        {
            logger.error("每天23点整定时执行任务rxaxx出错：" + e.toString());
        }
//*******************************抽取数据后的数据批量转换*************************************************************

        //清理不在宫颈病史的HPV,XBX,YDJ

        try {
            Db.update("delete from  gjghpvjc where SAVE_file=0 and id_no not in(select id_no from  gjgbs where SAVE_file=0 )");
        }
        catch(Exception e)
        {
            logger.error("清理不在宫颈病史的HPV任务出错：" + e.toString());
        }

        try {
            Db.update("delete from  gjgxbxjc where SAVE_file=0 and id_no not in(select id_no from  gjgbs where SAVE_file=0 )");
        }
        catch(Exception e)
        {
            logger.error("清理不在宫颈病史的xbx任务出错：" + e.toString());
        }
        try {
            Db.update("delete from  gjgydjjc where SAVE_file=0 and id_no not in(select id_no from  gjgbs where SAVE_file=0 )");
        }
        catch(Exception e)
        {
            logger.error("清理不在宫颈病史的ydj任务出错：" + e.toString());
        }
        //清理只做病史，不做hpv,ydj,xbx,zzbl

        try {
            Db.update("\n" +
                    "\n" +
                    "delete  from  gjgbs where SAVE_file=0 and id_no not in(\n" +
                    "select id_no from gjgxbxjc  where SAVE_file=0\n" +
                    "union\n" +
                    "select id_no from gjghpvjc  where SAVE_file=0\n" +
                    "union \n" +
                    "select id_no from gjgzhzd where SAVE_file=0\n" +
                    "union  \n" +
                    "select id_no from gjgydjjc where SAVE_file=0 )");
        }
        catch(Exception e)
        {
            logger.error("清理只做病史，不做hpv,ydj,xbx,zzbl：" + e.toString());
        }


        //处理既往史，年限**********************************************************************************************************************

        try {
            Db.update("update gjgbs set TREATED=1,TREATED_YEAR=1 where  dept_result<>'0000' and SAVE_file=0  ");
        }
        catch(Exception e)
        {
            logger.error("gjgbs既往史，年限任务出错：" + e.toString());
        }

        //处理病史异常fkjc**********************************************************************************************************************
        try {
            Db.update("update gjgfkjc set EXAMINATION=1 where   SAVE_file=0  and result not like '%宫颈:光滑%'  ");
        }
        catch(Exception e)
        {
            logger.error("异常fkjc任务出错：" + e.toString());
        }

        //滴虫

        try {
            Db.update("update gjgfkjc set EXAMINATION=1,TRICHOMONAS_VAGINITIS=1 where   SAVE_file=0 and (result not like '%滴虫:-%'and result not like '%滴虫:阴性%'and result not like '%滴虫:|%'  ) and  result  like '%滴虫%' ");
        }
        catch(Exception e)
        {
            logger.error("异常fkjc滴虫任务出错：" + e.toString());
        }
        //脓细胞
//
//        try {
//            Db.update("update gjgfkjc set EXAMINATION=1,MUCOPURULENT_CERVICITIS=1 where SAVE_file=0 and (result not like '%脓细胞:-%'and result not like '%脓细胞:阴性%'and result not like '%脓细胞:|%' ) and  result  like '%脓细胞%' ");
//        }
//        catch(Exception e)
//        {
//            logger.error("异常fkjc脓细胞任务出错：" + e.toString());
//        }
        //细菌

        try {
            Db.update("update gjgfkjc set EXAMINATION=1,VULVOVAGINAL_CANDIDIASIS=1 where   SAVE_file=0 and (result not like '%霉菌:-%'and result not like '%霉菌:阴性%' and result not like '%霉菌:|%')  and  result  like '%霉菌%' ");
        }
        catch(Exception e)
        {
            logger.error("异常fkjc霉菌任务出错：" + e.toString());
        }
//        try {
//            Db.update("update gjgfkjc set EXAMINATION=1,BACTERIAL_VAGINOSIS=1 where   SAVE_file=0 and (result not like '%肾型双球菌:未找到%') and  result  like '%肾型双球菌%' ");
//        }
//        catch(Exception e)
//        {
//            logger.error("异常fkjc肾型双球菌任务出错：" + e.toString());
//        }
        try {
            Db.update("update gjgfkjc set EXAMINATION=1,BACTERIAL_VAGINOSIS=1 where   SAVE_file=0 and (result not like '%线索细胞:-%'and result not like '%线索细胞:阴性%' and result not like '%线索细胞:|%') and  result  like '%线索细胞%'");
        }
        catch(Exception e)
        {
            logger.error("异常fkjc线性细胞任务出错：" + e.toString());
        }


        //处理HPV异常类型**********************************************************************************************************************
//        String[] tmp = {"16:阳性", "18:阳性", "31:阳性", "33:阳性", "35:阳性", "45:阳性", "52:阳性", "58:阳性"};
        try {
            //定时需要抽取数据集的相关代码
                Db.update("update gjghpvjc set HPV_CHECK=2,SIXTEEN=1 ,HPV_TYPING=1,FURTHER_EXAMINATION=1,COLPOSCOPY=1,CERVICAL_CYTOLOGY=1  where   SAVE_file=0 and   result  like '%16:阳性%'");
             }
        catch(Exception e)
        {            logger.error("处理HPV16异常类型异常：" + e.toString());        }
        try {
            //定时需要抽取数据集的相关代码
            Db.update("update gjghpvjc set HPV_CHECK=2,EIGHTEEN=1 ,HPV_TYPING=1,FURTHER_EXAMINATION=1,COLPOSCOPY=1,CERVICAL_CYTOLOGY=1   where   SAVE_file=0 and   result  like '%18:阳性%'");
        }
        catch(Exception e)
        {            logger.error("处理HPV18异常类型异常：" + e.toString());        }
        try {
            //定时需要抽取数据集的相关代码
            Db.update("update gjghpvjc set HPV_CHECK=2,THIRTY_ONE=1 ,HPV_TYPING=1,FURTHER_EXAMINATION=1,CERVICAL_CYTOLOGY=1  where   SAVE_file=0 and   result  like '%31:阳性%'");
        }
        catch(Exception e)
        {            logger.error("处理HPV31异常类型异常：" + e.toString());        }
        try {
            //定时需要抽取数据集的相关代码
            Db.update("update gjghpvjc set HPV_CHECK=2,THIRTY_THREE=1 ,HPV_TYPING=1,FURTHER_EXAMINATION=1,CERVICAL_CYTOLOGY=1 where   SAVE_file=0 and   result  like '%33:阳性%'");
        }
        catch(Exception e)
        {            logger.error("处理HPV33异常类型异常：" + e.toString());        }
        try {
            //定时需要抽取数据集的相关代码
            Db.update("update gjghpvjc set HPV_CHECK=2,THIRTY_FIVE=1 ,HPV_TYPING=1 ,FURTHER_EXAMINATION=1,CERVICAL_CYTOLOGY=1 where   SAVE_file=0 and   result  like '%35:阳性%'");
        }
        catch(Exception e)
        {            logger.error("处理HPV35异常类型异常：" + e.toString());        }
        try {
            //定时需要抽取数据集的相关代码
            Db.update("update gjghpvjc set HPV_CHECK=2,FORTY_FIVE=1 ,HPV_TYPING=1 ,FURTHER_EXAMINATION=1,CERVICAL_CYTOLOGY=1 where   SAVE_file=0 and   result  like '%45:阳性%'");
        }
        catch(Exception e)
        {            logger.error("处理HPV45异常类型异常：" + e.toString());        }
        try {
            //定时需要抽取数据集的相关代码
            Db.update("update gjghpvjc set HPV_CHECK=2,FIFTY_TWO=1 ,HPV_TYPING=1,FURTHER_EXAMINATION=1,CERVICAL_CYTOLOGY=1 where   SAVE_file=0 and   result  like '%52:阳性%'");
        }
        catch(Exception e)
        {            logger.error("处理HPV52异常类型异常：" + e.toString());        }
        try {
            //定时需要抽取数据集的相关代码
            Db.update("update gjghpvjc set HPV_CHECK=2,FIFTY_EIGHT=1 ,HPV_TYPING=1,FURTHER_EXAMINATION=1,CERVICAL_CYTOLOGY=1 where   SAVE_file=0 and   result  like '%58:阳性%'");
        }
        catch(Exception e)
        {            logger.error("处理HPV58异常类型异常：" + e.toString());        }

        try {
            //定时需要抽取数据集的相关代码
            Db.update("  update gjghpvjc set COLPOSCOPY=1 where   THIRTY_ONE+THIRTY_THREE+THIRTY_FIVE+FORTY_FIVE+FIFTY_TWO+FIFTY_EIGHT>=2  and  SAVE_file=0;");
        }
        catch(Exception e)
        {            logger.error("这几项同时有阳的，要做阴道镜：" + e.toString());        }



        //处理细胞学异常类型**********************************************************************************************************************

//        高度鳞状上皮内病变（HSIL）.
        try {
            //定时需要抽取数据集的相关代码
            Db.update("update gjgxbxjc set HSIL=1 ,check_type=5,COLPOSCOPY=1 where   SAVE_file=0 and   result  like '%HSIL%'");
        }
        catch(Exception e)
        {            logger.error("处理高度鳞状上皮内病变（HSIL）类型异常：" + e.toString());        }
//
//        无上皮内病变或恶性病变(NILM).
        try {
            //定时需要抽取数据集的相关代码
            Db.update("update gjgxbxjc set INTREAPITHELIAL_LESIONS=1  ,check_type=1  where   SAVE_file=0 and   result  like '%无上皮内病变或恶性病变(NILM)%'");
        }
        catch(Exception e)
        {            logger.error("处理无上皮内病变或恶性病变(NILM)类型异常：" + e.toString());        }
//       无上皮内病变或恶性病变(NILM)，细胞量少，标本已复查.
//
//       非典型鳞状上皮细胞，不明确意义（ASC-US）.
        try {
            //定时需要抽取数据集的相关代码
            Db.update("update gjgxbxjc set ASC_US=1  ,check_type=2,COLPOSCOPY=1  where   SAVE_file=0 and   result  like '%ASC-US%'");
        }
        catch(Exception e)
        {            logger.error("处理非典型鳞状上皮细胞，不明确意义（ASC-US）类型异常：" + e.toString());        }
//
//        不典型腺细胞（AGC）.
        try {
            //定时需要抽取数据集的相关代码
            Db.update("update gjgxbxjc set AGC=1   ,check_type=7,COLPOSCOPY=1 where   SAVE_file=0 and   result  like '%AGC%'");
        }
        catch(Exception e)
        {            logger.error("处理不典型腺细胞（AGC）类型异常：" + e.toString());        }
//        非典型鳞状上皮细胞，不排除高级别（ASC-H）.
        try {
            //定时需要抽取数据集的相关代码
            Db.update("update gjgxbxjc set ASC_H=1  ,check_type=3,COLPOSCOPY=1  where   SAVE_file=0 and   result  like '%ASC-H%'");
        }
        catch(Exception e)
        {            logger.error("处理 非典型鳞状上皮细胞，不排除高级别（ASC-H）.类型异常：" + e.toString());        }
//
//        低度鳞状上皮内病变（LSIL）.
        try {
            //定时需要抽取数据集的相关代码
            Db.update("update gjgxbxjc set LSIL=1  ,check_type=4,COLPOSCOPY=1  where   SAVE_file=0 and   result  like '%LSIL%'");
        }
        catch(Exception e)
        {            logger.error("处理低度鳞状上皮内病变（LSIL）类型异常：" + e.toString());        }
//        鳞状细胞癌（scc）
        try {
            //定时需要抽取数据集的相关代码
            Db.update("update gjgxbxjc set SCC=1   ,check_type=6,COLPOSCOPY=1  where   SAVE_file=0 and   result  like '%SCC%'");
        }
        catch(Exception e)
        {            logger.error("处理鳞状细胞癌（scc）类型异常：" + e.toString());        }





        //清理不在乳腺病史的外科触诊检查 select * from  rxgczxx where SAVE_file=0 and id_no not in(select id_no from  rxabs where SAVE_file=0);

        try {
            Db.update("delete from  rxgczxx where SAVE_file=0 and id_no not in(select id_no from  rxabs where SAVE_file=0)");
        }
        catch(Exception e)
        {
            logger.error("清理不在乳腺病史的外科触诊检查任务出错：" + e.toString());
        }

        //处理既往史，年限**********************************************************************************************************************
        try {
            Db.update("update rxabs set CHECK_BREAST_CANCER=1  where dept_result<>'0000' and SAVE_file=0  ");
        }
        catch(Exception e)
        {
            logger.error("rxabs，年限任务出错：" + e.toString());
        }


        //处理B超等级**********************************************************************************************************
//        -- 双侧乳腺未见占位性病变（BI-RADS分类 1类）
        try {
            Db.update("update cscsjcxx set CLASSIFICATION=2,YCLASSIFICATION=2  where SAVE_file=0 and  (result like '%双侧乳腺%BI-RADS 1类%'  or dept_result like '%双侧乳腺%BI-RADS 1类%'  )");
        }
        catch(Exception e)
        {
            logger.error("双侧乳腺未见占位性病变（BI-RADS分类 1类任务出错：" + e.toString());
        }
        try {
            Db.update("update cscsjcxx set CLASSIFICATION=3,YCLASSIFICATION=3  where SAVE_file=0 and  (result like '%双侧乳腺%BI-RADS 2类%'  or dept_result like '%双侧乳腺%BI-RADS 2类%'  )");
        }
        catch(Exception e)
        {
            logger.error("双侧乳腺未见占位性病变（BI-RADS分类 2类任务出错：" + e.toString());
        }
        try {
            Db.update("update cscsjcxx set CLASSIFICATION=4,YCLASSIFICATION=4  ,SUGGESTION=1 where SAVE_file=0 and  (result like '%双侧乳腺%BI-RADS 3类,%'  or dept_result like '%双侧乳腺%BI-RADS 3类%'  )");
        }
        catch(Exception e)
        {
            logger.error("双侧乳腺未见占位性病变（BI-RADS分类 3类任务出错：" + e.toString());
        }
        try {
            Db.update("update cscsjcxx set CLASSIFICATION=5,YCLASSIFICATION=5,SUGGESTION=2   where SAVE_file=0 and  (result like '%双侧乳腺%BI-RADS 4%'  or dept_result like '%双侧乳腺%BI-RADS 4%'  )");
        }
        catch(Exception e)
        {
            logger.error("双侧乳腺未见占位性病变（BI-RADS分类 4类任务出错：" + e.toString());
        }
//        -- 左侧乳腺未见占位性病变（BI-RADS分类 1类）。
        try {
            Db.update("update cscsjcxx set CLASSIFICATION=2 where SAVE_file=0 and  dept_result like '%左侧乳腺%BI-RADS 1类%' ");
        }
        catch(Exception e)
        {
            logger.error("左侧乳腺未见占位性病变（BI-RADS分类 1类）任务出错：" + e.toString());
        }
        try {
            Db.update("update cscsjcxx set CLASSIFICATION=3 where SAVE_file=0 and  dept_result like '%左侧乳腺%BI-RADS 2类%' ");
        }
        catch(Exception e)
        {
            logger.error("左侧乳腺未见占位性病变（BI-RADS分类 2类）任务出错：" + e.toString());
        }
        try {
            Db.update("update cscsjcxx set CLASSIFICATION=4 ,SUGGESTION=1 where SAVE_file=0 and  dept_result like '%左侧乳腺%BI-RADS 3类%' ");
        }
        catch(Exception e)
        {
            logger.error("左侧乳腺未见占位性病变（BI-RADS分类 3类）任务出错：" + e.toString());
        }
        try {
            Db.update("update cscsjcxx set CLASSIFICATION=5,SUGGESTION=2  where SAVE_file=0 and  dept_result like '%左侧乳腺%BI-RADS 4%' ");
        }
        catch(Exception e)
        {
            logger.error("左侧乳腺未见占位性病变（BI-RADS分类 4类）任务出错：" + e.toString());
        }
//        -- 右侧乳腺未见占位性病变（BI-RADS分类 1类）。
        try {
            Db.update("update cscsjcxx set YCLASSIFICATION=2 where SAVE_file=0 and  dept_result like '%右侧乳腺%BI-RADS 1类%' ");
        }
        catch(Exception e)
        {
            logger.error("右侧乳腺未见占位性病变（BI-RADS分类 1类）任务出错：" + e.toString());
        }
        try {
            Db.update("update cscsjcxx set YCLASSIFICATION=3 where SAVE_file=0 and  dept_result like '%右侧乳腺%BI-RADS 2类%' ");
        }
        catch(Exception e)
        {
            logger.error("右侧乳腺未见占位性病变（BI-RADS分类 2类）任务出错：" + e.toString());
        }
        try {
            Db.update("update cscsjcxx set YCLASSIFICATION=4 ,SUGGESTION=1 where SAVE_file=0 and  dept_result like '%右侧乳腺%BI-RADS 3类,%' ");
        }
        catch(Exception e)
        {
            logger.error("右侧乳腺未见占位性病变（BI-RADS分类 3类）任务出错：" + e.toString());
        }
        try {
            Db.update("update cscsjcxx set YCLASSIFICATION=5 ,SUGGESTION=2  where SAVE_file=0 and  dept_result like '%右侧乳腺%BI-RADS 4%' ");
        }
        catch(Exception e)
        {
            logger.error("右侧乳腺未见占位性病变（BI-RADS分类 4类）任务出错：" + e.toString());
        }

        //处理xx等级***************************************************************************************
//        双侧乳腺实质构成为C类   ：A,B,C，D
        try {
            Db.update("update rxaxx set CLASSIFICATION=2 ,YCLASSIFICATION=2 where SAVE_file=0 and  (dept_result like '%两侧%为1%' or dept_result like '%双侧%为1%') ");
        }
        catch(Exception e)
        {
            logger.error("两侧乳腺未见占位性病变（BI-RADS分类 1类）任务出错：" + e.toString());
        }
        try {
            Db.update("update rxaxx set CLASSIFICATION=3 ,YCLASSIFICATION=3 where SAVE_file=0 and  (dept_result like '%两侧%为2%' or dept_result like '%双侧%为2%' )");
        }
        catch(Exception e)
        {
            logger.error("两侧乳腺未见占位性病变（BI-RADS分类 2类）任务出错：" + e.toString());
        }
        try {
            Db.update("update rxaxx set CLASSIFICATION=4 ,YCLASSIFICATION=4 ,SUGGESTION=1 where SAVE_file=0 and  (dept_result like '%两侧%为3%' or dept_result like '%双侧%为3%') ");
        }
        catch(Exception e)
        {
            logger.error("两侧乳腺未见占位性病变（BI-RADS分类 3类）任务出错：" + e.toString());
        }
        try {
            Db.update("update rxaxx set CLASSIFICATION=5 ,YCLASSIFICATION=5,SUGGESTION=4  where SAVE_file=0 and  (dept_result like '%两侧%为4%' or dept_result like '%双侧%为4%' ) ");
        }
        catch(Exception e)
        {
            logger.error("两侧乳腺未见占位性病变（BI-RADS分类 4类）任务出错：" + e.toString());
        }
//左侧
        try {
            Db.update("update rxaxx set CLASSIFICATION=2 where SAVE_file=0 and  dept_result like '%左%为1%' ");
        }
        catch(Exception e)
        {
            logger.error("左侧乳腺未见占位性病变（BI-RADS分类 1类）任务出错：" + e.toString());
        }
        try {
            Db.update("update rxaxx set CLASSIFICATION=3 where SAVE_file=0 and  dept_result like '%左%为2%' ");
        }
        catch(Exception e)
        {
            logger.error("左侧乳腺未见占位性病变（BI-RADS分类 2类）任务出错：" + e.toString());
        }
        try {
            Db.update("update rxaxx set CLASSIFICATION=4 ,SUGGESTION=1 where SAVE_file=0 and  dept_result like '%左%为3%' ");
        }
        catch(Exception e)
        {
            logger.error("左侧乳腺未见占位性病变（BI-RADS分类 3类）任务出错：" + e.toString());
        }
        try {
            Db.update("update rxaxx set CLASSIFICATION=5 ,SUGGESTION=4 where SAVE_file=0 and  dept_result like '%左%为4%' ");
        }
        catch(Exception e)
        {
            logger.error("左侧乳腺未见占位性病变（BI-RADS分类 4类）任务出错：" + e.toString());
        }
//        右侧

        try {
            Db.update("update rxaxx set YCLASSIFICATION=2 where SAVE_file=0 and  dept_result like '%右%为1%' ");
        }
        catch(Exception e)
        {
            logger.error("右侧乳腺未见占位性病变（BI-RADS分类 1类）任务出错：" + e.toString());
        }
        try {
            Db.update("update rxaxx set YCLASSIFICATION=3 where SAVE_file=0 and  dept_result like '%右%为2%' ");
        }
        catch(Exception e)
        {
            logger.error("右侧乳腺未见占位性病变（BI-RADS分类 2类）任务出错：" + e.toString());
        }
        try {
            Db.update("update rxaxx set YCLASSIFICATION=4  ,SUGGESTION=1 where SAVE_file=0 and  dept_result like '%右%为3%' ");
        }
        catch(Exception e)
        {
            logger.error("右侧乳腺未见占位性病变（BI-RADS分类 3类）任务出错：" + e.toString());
        }
        try {
            Db.update("update rxaxx set YCLASSIFICATION=5 ,SUGGESTION=4 where SAVE_file=0 and  dept_result like '%右%为4%' ");
        }
        catch(Exception e)
        {
            logger.error("右侧乳腺未见占位性病变（BI-RADS分类 4类）任务出错：" + e.toString());
        }

//        System.out.println("程序继续执行...");
    }
    }


